package game.view.mediator 
{
	import game.constants.ApplicationNotification;
	import game.model.player.PlayerProxy;
	import game.view.screen.MenuScreen;
	import org.puremvc.as3.interfaces.IMediator;
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.mediator.Mediator;
	/**
	 * ...
	 * @author Thot
	 */
	public class MenuMediator extends Mediator implements IMediator
	{
		
		public static const NAME:String = "MenuMediator";
		private var _screen:MenuScreen;
		
		public function MenuMediator( p_menu:MenuScreen) 
		{
			_screen = p_menu;
			super( NAME, _screen );
			
			init();
		}
		
		private function init():void 
		{
			_screen.init();
		}
		
		override public function listNotificationInterests():Array
		{
			return [ ApplicationNotification.UPDATE_DATA ];
		}
		
		
		override public function handleNotification (notification:INotification) : void
		{
			var proxy:PlayerProxy = facade.retrieveProxy(PlayerProxy.NAME) as PlayerProxy;
			
			switch( notification.getName() )
			{
				case ApplicationNotification.UPDATE_DATA:
					_screen.updateStatus( proxy.currentPlayer.gold, proxy.currentPlayer.mana, proxy.currentPlayer.gems );
					break;
			}
		}
		
		
	}

}